<HTML><HEAD><TITLE>tyi(+Stream, -Ascii)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Character I/O</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>tyi(+Stream, -Ascii)</H1>
Succeeds if the ascii code of the next character read in raw mode from the
input stream Stream is successfully unified with Ascii.


<DL>
<DT><EM>Stream</EM></DT>
<DD>Integer (stream number) or Atom (reserved or user-defined                symbolic stream name).
</DD>
<DT><EM>Ascii</EM></DT>
<DD>Variable or integer.
</DD>
</DL>
<H2>Description</H2>
   Takes the next character from the unbuffered input stream Stream and
   unifies its integer ASCII code (in the range 0 to 255) with Ascii.  The
   input is in raw mode so that no newline character must be typed, and the
   character is not echoed on the screen.

<P>
   ASCII codes for the non-printable characters (i.e.  control characters)
   are also acceptable.

<P>
Note
   tyi/2 reads from the stream in raw mode.  If it is combined with the
   buffered predicates, it might happen that some characters typed ahead
   may be lost if the input device is a terminal.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>tyi(+, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Stream is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Stream is neither an integer nor an atom.
<DT><EM>(5) type error </EM>
<DD>Ascii is instantiated, but not to an integer.
<DT><EM>(190) end of file reached </EM>
<DD>End of file has been reached.
<DT><EM>(192) illegal stream mode </EM>
<DD>Stream is not an input stream.
<DT><EM>(193) illegal stream specification </EM>
<DD>Stream is an illegal stream specification.
<DT><EM>(198) reading past the file end </EM>
<DD>Trying to read even after the error 190 was raised.
</DL>
<H2>Examples</H2>
<PRE>
Success:
      [eclipse]: tyi(input,Ascii).
      Ascii = 97            % press 'a'
      yes.

      [eclipse]: tyi(input,97).
                            % press 'a'
      yes.

      [eclipse]: tyi(input,Ascii).
      Ascii = 4                 % press ^D
      yes.

Fail:
      [eclipse]: tyi(input, 0'b).
                               % press 'a'
      no.

Error:
      tyi(Stream,98).             (Error 4).
      tyi(input, '98').           (Error 5).
      tyi(input, 98.0).           (Error 5).
      tyi("string", A).           (Error 5).

      [eclipse]: open(file1,update,s), write(s,p),
      &gt; seek(s,0), tyi(s,Ascii),
      tyi(s,Ascii).              (Error 190).
      tyi(9,A).                  (Error 192).
      tyi(atom,A).               (Error 193).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/iochar/tyi-1.html">tyi / 1</A>, <A HREF="../../kernel/iochar/tyo-1.html">tyo / 1</A>, <A HREF="../../kernel/iochar/tyo-2.html">tyo / 2</A>
</BODY></HTML>
